<template>
	<div>
		<div class="member-center-main">
			<div class="member-center-menu">
				<div class="info-block">
					<div class="playerid">{{info.name}}</div>
				</div>
				<div class="balance-info">
					<div class="currency">{{$t('indexTitle.title23')}}</div>
					<div class="balance">{{info.money||0}}</div>
				</div>
				<div class="nav-block">
					<div class="item" :class="tabTow == 0 ? 'active':''" @click="goNextPage('/mine')">
						<img src="../../assets/icons/gerenziliao.png" alt="" />
						<div class="label">{{$t('indexTitle.title24')}}</div>
					</div>
					<div class="item" :class="tabTow == 1 ? 'active':''" @click="goNextPage('/vipRebates')">
						<img src="../../assets/icons/vip.png" alt="" />
						<div class="label">{{$t('indexTitle.title321')}}</div>
					</div>
					<div class="item" :class="tabTow == 2 ? 'active':''" @click="goNextPage('/deposit')">
						<img src="../../assets/icons/chongzhi.png" alt="" />
						<div class="label">{{$t('indexTitle.title26')}}</div>
					</div>
					<div class="item" :class="tabTow == 3 ? 'active':''" @click="goNextPage('/withdraw')">
						<img src="../../assets/icons/tixian.png" alt="" />
						<div class="label">{{$t('indexTitle.title27')}}</div>
					</div>
					<!-- <div class="item" :class="tabTow == 4 ? 'active':''" @click="goNextPage('/affiliate')">
						<img src="../../assets/icons/tuiguangfenxiao.png" alt="" />
						<div class="label">{{$t('indexTitle.title28')}}</div>
					</div> -->
					<div class="item" :class="tabTow == 5 ? 'active':''" @click="goNextPage('/mission')">
						<img src="../../assets/icons/renwurizhi.png" alt="" />
						<div class="label">{{$t('indexTitle.title29')}}</div>
					</div>
					<div class="item" :class="tabTow == 6 ? 'active':''" @click="goNextPage('/promotions')">
						<img src="../../assets/icons/youhuizhongxin.png" alt="" />
						<div class="label">{{$t('indexTitle.title30')}}</div>
					</div>
					<div class="item" :class="tabTow == 7 ? 'active':''" @click="goNextPage('/game-history')">
						<img src="../../assets/icons/youxijilu.png" alt="" />
						<div class="label">{{$t('indexTitle.title31')}}</div>
					</div>
					<div class="item" :class="tabTow == 8 ? 'active':''" @click="goNextPage('/finan-history')">
						<img src="../../assets/icons/caiwujilu.png" alt="" />
						<div class="label">{{$t('indexTitle.title32')}}</div>
					</div>
					<div class="item" :class="tabTow == 9 ? 'active':''" @click="goNextPage('/personalMsg')">
						<img src="../../assets/icons/gonggaozhongxin.png" alt="" />
						<div class="label">{{$t('indexTitle.title33')}}</div>
					</div>
				</div>
			</div>
			<div class="member-center-content">
				<div class="member-center-profile">
					<div class="title">{{$t('indexTitle.title29')}}</div>
					<div class="nrc-tabs">
						<div class="nrc-tabs-nav">
							<div class="nrc-tabs-tab" :class="tab == 0 ? 'active':''" @click="changetab(0)">
								{{$t('indexTitle.title234')}}
							</div>
							<!-- <div class="nrc-tabs-tab" :class="tab == 1 ? 'active':''" @click="changetab(1)">
								{{$t('indexTitle.title235')}}
							</div>
							<div class="nrc-tabs-tab" :class="tab == 2 ? 'active':''" @click="changetab(2)">
								{{$t('indexTitle.title236')}}
							</div> -->
							<div class="nrc-tabs-tab" :class="tab == 3 ? 'active':''" @click="changetab(3)">
								{{$t('indexTitle.title237')}}
							</div>
						</div>
						<div class="history-cards-wrapper" v-if="tab == 0">
							<!-- <div class="mission-period">
								{{$t('indexTitle.title147')}}:08:02:52
							</div> -->
							<div class="item" v-for="(it,index) in renWuList" :key="index">
								<div>
									<div class="mission-title">{{it.name}}</div>
									<div class="mission-threshold-progress">
										<span class="threshold-text"
												v-if="it.type==1">{{$t('indexTitle.title267')}}{{it.num}}</span>
											<span class="threshold-text"
												v-if="it.type==2">{{$t('indexTitle.title268')}}{{it.num}}</span>
											<span class="threshold-text"
												v-if="it.type==3">{{$t('indexTitle.title313')}}{{it.num}}</span>
											<span class="threshold-text"
												v-if="it.type==4">{{$t('indexTitle.title314')}}{{it.num}}</span>
											<span class="threshold-text"
												v-if="it.type==5">{{$t('indexTitle.title315')}}{{it.num}}</span>
											<span class="threshold-text"
												v-if="it.type==6">{{$t('indexTitle.title316')}}{{it.num}}</span>
											<span class="threshold-text"
												v-if="it.type==7">{{$t('indexTitle.title317')}}{{it.num}}</span>
											<span class="threshold-text"
												v-if="it.type==8">{{$t('indexTitle.title318')}}{{it.num}}</span>
											<span class="threshold-text"
												v-if="it.type==9">{{$t('indexTitle.title319')}}{{it.num}}</span>
										<div class="progress-box">
											<div class="progress-text">{{it.user_num}}/{{it.num}}</div>
											<div class="progress-bar">
												<div class="progress-line" :style="{'width':it.widthSize}"></div>
												<div class="progress-line" style="width: 100%;" v-if="it.wanchen"></div>
											</div>
										</div>
									</div>
								</div>
								<div class="reward-row">
									<span v-if="it.type2==1">{{$t('indexTitle.title269')}} {{it.zhuanpangcishu}}
										{{$t('indexTitle.title270')}}</span>
									<span v-if="it.type2==2">{{$t('indexTitle.title319')}}￥{{it.zhuanpangcishu}}</span>
									<el-button v-if="!it.wanchen&&it.dabiao"
										@click="submitRenwu(it)">{{$t('indexTitle.title155')}}</el-button>
									<div class="" v-if="it.wanchen">
										{{$t('indexTitle.title271')}}
									</div><el-button v-if="!it.wanchen&&!it.dabiao"
										class="asdfas">{{$t('indexTitle.title272')}}</el-button>
									<!-- <div class="" style="color: #939698;" v-if="!it.wanchen&&!it.dabiao">
										{{$t('indexTitle.title272')}}
									</div> -->
								</div>
							</div>
						</div>
						<div class="history-cards-wrapper" v-if="tab == 1">
							<div class="mission-period">
								{{$t('indexTitle.title147')}}:08:02:52
							</div>
							<div class="item">
								<div>
									<div class="mission-title">{{$t('indexTitle.title148')}}</div>
									<div class="mission-threshold-progress">
										<span class="threshold-text">100 {{$t('indexTitle.title149')}}</span>
										<div class="progress-box">
											<div class="progress-text">0/100</div>
											<div class="progress-bar">
												<div class="progress-line" style="width: 0%;"></div>
											</div>
										</div>
									</div>
								</div>
								<div class="reward-row">
									<span>+ {{$t('indexTitle.title150')}} 3 {{$t('indexTitle.title151')}}</span>
								</div>
							</div>
							<div class="item">
								<div>
									<div class="mission-title">{{$t('indexTitle.title152')}}</div>
									<div class="mission-threshold-progress">
										<span class="threshold-text">3{{$t('indexTitle.title153')}}</span>
										<div class="progress-box completed">
											<div class="progress-text">{{$t('indexTitle.title154')}}</div>
											<div class="progress-bar">
												<div class="progress-line" style="width: 100%;"></div>
											</div>
										</div>
									</div>
								</div>
								<div class="reward-row">
									<span>+ {{$t('indexTitle.title150')}} 3 {{$t('indexTitle.title151')}}</span>
									<el-button>{{$t('indexTitle.title155')}}</el-button>
								</div>
							</div>
						</div>
						<div class="adsfsd" v-if="tab == 3">
							<indexTow></indexTow>
							<!-- <div class="mission-periodlll">
								<div class="mission-period">
									{{$t('indexTitle.title263')}} {{chongzhilianInfo.zongtianshu}}
									{{$t('indexTitle.title257')}}
								</div>
								<div class="mission-period">
									{{$t('indexTitle.title264')}} {{chongzhilianInfo.zongshouyi}}
								</div>
							</div>
							<div class="mission-periodlll">
								<div class="mission-period">
									{{$t('indexTitle.title265')}} {{chongzhilianInfo.chongzhi}}
								</div>
								<div class="mission-period">
									{{$t('indexTitle.title266')}} {{chongzhilianInfo.maliang}}
								</div>
							</div>
							<div class="item" v-for="(it,index) in qianbaoList" :key="index">
								<div>
									<div class="mission-title">
										{{$t('indexTitle.title256')}}{{it.tianshu}}{{$t('indexTitle.title257')}}
									</div>
									<div class="mission-threshold-progress">
										<span class="threshold-text">{{$t('indexTitle.title258')}}{{it.money}}</span>
										<div class="progress-box" v-if="it.tianshu==chongzhilianInfo.qiandaotianshu+1">
											<div class="progress-text">
												{{$t('indexTitle.title259')}}0/{{it.chongzhilian}}
											</div>
											<div class="progress-bar">
												<div class="progress-line" style="width: 0%;"></div>
											</div>
										</div>
										<div class="progress-box completed"
											v-if="it.tianshu<chongzhilianInfo.qiandaotianshu">
											<div class="progress-text">{{$t('indexTitle.title154')}}</div>
											<div class="progress-bar">
												<div class="progress-line" style="width: 100%;"></div>
											</div>
										</div>
									</div>
								</div>
								<div class="reward-row">
									<span>{{$t('indexTitle.title260')}}{{it.malian}}</span>
									<el-button v-if="it.tianshu==chongzhilianInfo.qiandaotianshu+1&&it.dabiao"
										@click="getqiandao(it)">{{$t('indexTitle.title261')}}</el-button>
									<el-button class="asdfas"
										v-if="it.tianshu<chongzhilianInfo.qiandaotianshu+1&&it.dabiao">{{$t('indexTitle.title262')}}</el-button>
									<el-button v-if="!it.dabiao"
										class="asdfas">{{$t('indexTitle.title272')}}</el-button>
								</div>
							</div> -->
						</div>
						<div class="history-cards-wrapper" v-if="tab == 2">
							<div class="no-data-container">{{$t('indexTitle.title156')}}</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<loadingFour :msgText="msgTextTow" v-if="isShowLoadingTeow" @closeGuanbiTow="closeGuanbi"></loadingFour>
	</div>
</template>

<script>
	import indexTow from '../index/indexTow.vue';
	import loadingFour from '../../components/loadingFour.vue';
	import {
		qiandaoTianshuList,
		qiandao,
		chongzhilian,
		userinfo,
		renwuList,
		renwuSubmit
	} from "../../utils/api.js"
	export default {

		data() {
			return {
				tab: 0,
				tabTow: 5,
				close: true,
				info: [],
				qianbaoList: [],
				chongzhilianInfo: {},
				renWuList: [],
				msgTextTow: "",
				isShowLoadingTeow: false
			}
		},
		components: {
			indexTow,
			loadingFour
		},
		created() {

		},
		mounted() {
			this.getqiandaoTianshuList();
			this.getchongzhilian();
			this.info = JSON.parse(localStorage.getItem('userInfo'))
			// this.getuserinfo()
		},

		methods: {
			closeGuanbi(e) {
				this.isShowLoadingTeow = false;
			},
			getqiandaoTianshuList() {
				let data = {}
				qiandaoTianshuList(data).then((res) => {
					if (res.status.errorCode == 0) {
						this.qianbaoList = res.data
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getchongzhilian() {
				let data = {}
				chongzhilian(data).then((res) => {
					if (res.status.errorCode == 0) {
						this.chongzhilianInfo = res.data
						this.getRenwuList();
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getRenwuList() {
				let data = {}
				renwuList(data).then((res) => {
					if (res.status.errorCode == 0) {
						res.data.forEach((it, index) => {
							if (!it.wanchen) {
								if (it.user_num == 0 || it.user_num == 0.00) {
									it.widthSize = 0 + '%'
								} else if (parseFloat(it.user_num) > parseFloat(it.num) || parseFloat(it
										.user_num) == parseFloat(it.num)) {
									it.widthSize = 100 + '%'
								} else {
									it.widthSize = (parseFloat(parseInt(it.user_num) / parseInt(it.num))
										.toFixed(2)) * 100 + '%'
								}
							}
						})
						this.renWuList = res.data;
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			submitRenwu(it) {
				let data = {
					id: it.id
				}
				renwuSubmit(data).then((res) => {
					if (res.status.errorCode == 0) {
						this.renWuList = [];
						this.getRenwuList();
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				})
			},
			getqiandao(it) {
				let data = {
					data: it.money
				}
				qiandao(data).then((res) => {
					console.log(res);
					if (res.status.errorCode == 0) {
						this.chongzhilianInfo = {};
						this.getchongzhilian();
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getuserinfo() {
				this.info = [];
				userinfo().then((res) => {
					if (res.status.errorCode == 0) {
						this.info = res.data
					} else if (res.status.errorCode == 401) {
						this.$emit('getTokenNum', false)
						console.log('401')
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			changetab(e) {
				this.tab = e
			},
			goNextPage(page) {
				this.$router.push(page)
			},
			goBack() {
				this.$router.go(-1)
			}
		}
	}
</script>

<style scoped>
	* {
		box-sizing: border-box;
		margin: 0;
		padding: 0;
	}

	.navbar {
		background-color: #fff;
		box-shadow: inset 0 -1px 0 #ececec;
		color: #545658;
		height: 45px;
		left: 0;
		overflow: hidden;
		display: flex;
		justify-content: space-between;
		align-items: center;
		position: fixed;
		padding: 0 10px;
		top: 0;
		width: 100%;
		z-index: 9999;
	}

	.hearderBoxIcon {
		flex: .25;
		line-height: 1;
	}

	.hearderBoxIcon img {
		width: 26px;
		height: 26px;
	}

	.title {
		flex: 1;
		font-size: 20px;
		line-height: 1;
		text-align: center;
	}

	.right {
		flex: .25;
	}

	.nrc-tabs {
		margin-top: 45px;
	}

	.nrc-tabs-nav {
		align-items: center;
		display: flex;
		border-bottom-color: #e9e9e9;
		justify-content: space-evenly;
	}

	.nrc-tabs-tab {
		flex: 1;
		font-weight: 400;
		line-height: unset;
		box-sizing: border-box;
		display: block;
		font-size: 16px;
		cursor: pointer;
		font-stretch: normal;
		font-style: normal;
		text-align: center;
		min-width: 65px;
		padding: 8px;
	}

	.nrc-tabs-tab.active {
		background-image: unset;
		border-bottom: 2px solid #7240ff;
		color: #7240ff;
	}

	.history-cards-wrapper {
		display: flex;
		flex-direction: column;
		height: 100%;
		padding: 15px 10px 0;
	}

	.adsfsd {
		width: 100%;
		padding: 15px 10px 0;
	}

	.mission-periodlll {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.mission-period {
		color: #5235ff;
		font-size: 14px;
		padding-bottom: 10px;
	}

	.history-cards-wrapper .item {
		height: 110px;
		width: 100%;
		margin-bottom: 20px;
		background-color: #fff;
		border-radius: 5px;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		font-size: 14px;
		justify-content: space-between;
		padding: 15px;
	}

	.mission-title {
		color: #545658;
		font-size: 16px;
		font-weight: 400;
		line-height: 16px;
		margin-bottom: 6px;
	}

	.mission-threshold-progress {
		display: flex;
		font-size: 14px;
		justify-content: space-between;
	}

	.threshold-text {
		color: #939698;
		flex: 1;
		line-height: 18px;
		padding: 0 3px 0 0;
	}

	.progress-box {
		align-items: center;
		display: flex;
		margin-left: 8px;
	}

	.progress-text {
		color: #939698;
		font-size: 12px;
	}

	.progress-bar {
		border: 1px solid #ffba00;
		border-radius: 20px;
		height: 10px;
		margin-left: 5px;
		overflow: hidden;
		width: 150px;
	}

	.progress-line {
		background-color: #ffba00;
		height: 10px;
	}

	.reward-row {
		align-items: center;
		color: #5235ff;
		display: flex;
		font-size: 12px;
		justify-content: space-between;
	}

	.progress-box.completed .progress-bar {
		border: 1px solid #75943e;
	}

	.progress-box.completed .progress-bar .progress-line {
		background-color: #75943e;
	}

	/deep/ .el-button {
		background-color: #5235ff;
		border-radius: 10px;
		color: #fff;
		font-size: 12px;
		padding: 3px 12px;
		background-image: none;
		box-shadow: none;
		height: 30px;
		min-width: 25%;
	}

	/deep/ .asdfas {
		background-color: #939698;
	}

	.no-data-container {
		color: #545658;
		display: flex;
		flex-direction: column;
		font-size: 16px;
		justify-content: center;
		min-height: calc(100vh - 117px);
		opacity: .6;
		text-align: center;
	}

	.buttons {
		position: fixed;
		bottom: 10%;
		right: 10px;
		background-color: #99D2E3;
		width: 60px;
		height: 60px;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.buttons img {
		width: 32px;
		height: 32px;
	}

	.event-qmenu {
		bottom: 100px;
		height: auto !important;
		left: 0;
		min-height: auto !important;
		position: fixed;
		transition: .3s ease;
		width: 100px;
		z-index: 21;
	}

	.event-qmenu.close {
		transform: translateX(-73px);
	}

	.handle {
		bottom: 5px;
		height: 84px;
		position: absolute;
		right: 3px;
		width: 30px;
	}

	svg:not(:root) {
		overflow: hidden;
	}

	.event-qmenu .handle path {
		fill: #7240ff;
	}

	.handle::after {
		speak: none;
		color: #fff;
		content: ">";
		font-family: iconmps !important;
		font-size: 20px;
		font-style: normal;
		font-variant: normal;
		font-weight: 400;
		left: -2px;
		line-height: 1;
		position: absolute;
		text-align: center;
		text-shadow: 0 -1px 3px #4c0dff;
		text-transform: none;
		top: 50%;
		transform: translateY(-50%) rotate(180deg);
		width: 30px;
	}

	.event-qmenu.close .handle::after {
		left: 0px;
		text-shadow: 0 1px 3px #4c0dff;
		transform: translateY(-50%) rotate(0deg);
	}

	@keyframes aqm {
		0% {
			box-shadow: 0 2px 6px rgba(0, 0, 0, .8);
		}

		55% {
			box-shadow: 0 2px 4px #aa8dff;
		}

		70% {
			box-shadow: 0 2px 4px #bda6ff;
		}

		100% {
			box-shadow: 0 2px 6px rgba(0, 0, 0, .8);
		}
	}

	.cont {
		align-items: center;
		animation: aqm 1.8s ease infinite;
		background-color: rgba(0, 0, 0, .8);
		border: 3px solid #7240ff;
		border-bottom-right-radius: 15px;
		border-left: 0;
		border-top-right-radius: 15px;
		box-shadow: 0 2px 6px rgba(0, 0, 0, .8);
		display: flex;
		flex-wrap: wrap;
		min-height: 103px;
		padding: 10px;
		width: 70px;
	}

	.event-item {
		align-items: center;
		display: flex;
		height: 50px;
		justify-content: center;
		margin: 5px 0;
		position: relative;
		transition: .3s ease;
		width: 50px;
	}

	.event-item img {
		display: block;
		max-height: 100%;
		max-width: 100%;
	}

	.member-center-main {
		color: #545658;
		display: flex;
		justify-content: center;
		margin: 0 auto;
		max-width: 1280px;
		padding: 20px 0;
		width: 100%;
	}

	.member-center-menu {
		overflow: hidden;
		width: 220px;
		margin-top: 10px;
	}

	.info-block {
		align-items: center;
		border-bottom: 1px solid #e9e9e9;
		display: flex;
		padding: 30px 15px 15px;
	}

	.playerid {
		font-size: 22px;
		font-weight: 600;
		word-break: break-all;
	}

	.balance-info {
		align-items: flex-end;
		border-bottom: 1px solid #e9e9e9;
		display: flex;
		justify-content: space-between;
		padding: 15px;
	}

	.currency {
		padding-right: 8px;
	}

	.balance {
		font-size: 18px;
		font-weight: 500;
	}

	.nav-block {
		align-items: center;
		display: flex;
		flex-direction: column;
	}

	.nav-block .item {
		align-items: center;
		box-sizing: border-box;
		color: #939698;
		cursor: pointer;
		display: flex;
		height: 60px;
		line-height: 1.4;
		padding: 0 15px;
		position: relative;
		transition: .3s ease;
		width: 100%;
	}

	.item.active {
		color: #5235ff;
	}

	.item:hover {
		color: #5235ff;
	}

	.item img {
		width: 35px;
		height: 35px;
		margin-right: 12px;
	}

	.item .label {
		font-size: 16px;
		font-weight: 500;
		line-height: 1.2;
	}

	.member-center-content {
		background: #f9f9f9;
		margin-top: 10px;
		border-radius: 10px;
		box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .15);
		display: flex;
		justify-content: space-between;
		min-height: 700px;
		overflow: hidden;
		position: relative;
		width: calc(100% - 220px);
	}

	.member-center-profile {
		padding: 24px;
		width: 100%;
		position: relative;
	}

	.title {
		color: #545658;
		margin-bottom: 25px;
		font-size: 19px;
		font-weight: 600;
		line-height: 24px;
	}
</style>